/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "KET_RESULT", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "KetResult.findAll", query = "SELECT k FROM KetResult k"),
    @NamedQuery(name = "KetResult.findByMaTinh", query = "SELECT k FROM KetResult k WHERE k.ketResultPK.maTinh = :maTinh ORDER BY k.rating DESC"),
    @NamedQuery(name = "KetResult.findByCauNumber", query = "SELECT k FROM KetResult k WHERE k.ketResultPK.cauNumber = :cauNumber"),
    @NamedQuery(name = "KetResult.findByCauId", query = "SELECT k FROM KetResult k WHERE k.cauId = :cauId"),
    @NamedQuery(name = "KetResult.findByRating", query = "SELECT k FROM KetResult k WHERE k.rating = :rating"),
    @NamedQuery(name = "KetResult.findByWinDate", query = "SELECT k FROM KetResult k WHERE k.winDate = :winDate"),
    @NamedQuery(name = "KetResult.findByStartEffectDate", query = "SELECT k FROM KetResult k WHERE k.startEffectDate = :startEffectDate"),
    @NamedQuery(name = "KetResult.findByEndEffectDate", query = "SELECT k FROM KetResult k WHERE k.endEffectDate = :endEffectDate")})
public class KetResult implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected KetResultPK ketResultPK;
    @Size(max = 2000)
    @Column(name = "CAU_ID")
    private String cauId;
    @Size(max = 2000)
    @Column(name = "RATING")
    private String rating;
    @Size(max = 4000)
    @Column(name = "WIN_DATE")
    private String winDate;
    @Column(name = "START_EFFECT_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startEffectDate;
    @Column(name = "END_EFFECT_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endEffectDate;

    public KetResult() {
    }

    public KetResult(KetResultPK ketResultPK) {
        this.ketResultPK = ketResultPK;
    }

    public KetResult(String maTinh, String cauNumber) {
        this.ketResultPK = new KetResultPK(maTinh, cauNumber);
    }

    public KetResultPK getKetResultPK() {
        return ketResultPK;
    }

    public void setKetResultPK(KetResultPK ketResultPK) {
        this.ketResultPK = ketResultPK;
    }

    public String getCauId() {
        return cauId;
    }

    public void setCauId(String cauId) {
        this.cauId = cauId;
    }

    public String getRating() {
        return rating;
    }

    public void setRating(String rating) {
        this.rating = rating;
    }

    public String getWinDate() {
        return winDate;
    }

    public void setWinDate(String winDate) {
        this.winDate = winDate;
    }

    public Date getStartEffectDate() {
        return startEffectDate;
    }

    public void setStartEffectDate(Date startEffectDate) {
        this.startEffectDate = startEffectDate;
    }

    public Date getEndEffectDate() {
        return endEffectDate;
    }

    public void setEndEffectDate(Date endEffectDate) {
        this.endEffectDate = endEffectDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ketResultPK != null ? ketResultPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof KetResult)) {
            return false;
        }
        KetResult other = (KetResult) object;
        if ((this.ketResultPK == null && other.ketResultPK != null) || (this.ketResultPK != null && !this.ketResultPK.equals(other.ketResultPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.thienloc.omap.entity.KetResult[ ketResultPK=" + ketResultPK + " ]";
    }
    
}
